window.onload = function () {
    var regtel = /^1[3|4|5|7|8]\d{9}$/;//手机号码正则表达式
    var regqq = /^[1-9]\d{5,}$/;//QQ
    var regnc = /^[\u4e00-\u9fa5]{2,8}$/
    var regyzm = /^\d{6}$/;
    var regymima = /^[a-zA-Z0-9_-]{6,16}$/;
    var tel = document.querySelector('#tel');
    var qq = document.querySelector('#qq');
    var nc = document.querySelector('#nc');
    var yzm = document.querySelector('#yzm');
    var miam = document.querySelector('#mima');
    var qr = document.querySelector('#qr');
    regexp(tel, regtel);
    regexp(qq, regqq);
    regexp(nc, regnc);
    regexp(yzm, regyzm);
    regexp(miam, regymima);
    function regexp(ele, reg) {
        ele.onblur = function () {
            if (reg.test(this.value)) {
                this.nextElementSibling.className = 'success';
                this.nextElementSibling.innerHTML = '<i class="success_icon"></i> 号码格式正确，';
            }
            else {
                this.nextElementSibling.className = 'error';
                this.nextElementSibling.innerHTML = '<i class="error_icon"></i> 号码格式不正确，请从新输入';
            }
        }
    };
    qr.onblur = function () {
        if (this.value == miam.value) {
            this.nextElementSibling.className = 'success';
            this.nextElementSibling.innerHTML = '<i class="success_icon"></i> 格式正确，';
        }
        else {
            this.nextElementSibling.className = 'error';
            this.nextElementSibling.innerHTML = '<i class="error_icon"></i> 两次输入密码不一致，请从新输入';


        }
    }
}